from sqlalchemy import Column, Integer, String
from model import db

#
class Uploadfile(db.Base):

    __tablename__ = 'uploadfile'

    id = Column(Integer, primary_key=True, autoincrement=True)
    user_id = Column(String)
    article_data_id = Column(Integer)

    name = Column(String)
    ext = Column(String)
    size = Column(String)
    path = Column(String)
    content = Column(String)

    created_time = Column(String,server_default="CURRENT_TIMESTAMP")
    updated_time = Column(String,server_default="CURRENT_TIMESTAMP")

    def to_json(self):
        dict = self.__dict__
        if "_sa_instance_state" in dict:
            del dict["_sa_instance_state"]
        return dict
    